package com.dapeng.cleardatabackend.model.vo.graphdetail;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author dapeng
 * @description 关系
 * @date 2024/12/22 22:37
 */
@Data
@ApiModel(description = "图谱关系")
public class Link implements Serializable {

    private static final long serialVersionUID = 431319699180079952L;

    /**
     * 前键id
     */
    @ApiModelProperty(value = "前键id")
    private Long source;

    /**
     * 后键id
     */
    @ApiModelProperty(value = "后键id")
    private Long target;

    /**
     * 关系值
     */
    @ApiModelProperty(value = "关系值")
    private String value;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Link)) {
            return false;
        }
        Link link = (Link) o;
        return Objects.equals(source, link.source)
                && Objects.equals(target, link.target)
                && Objects.equals(value, link.value);
    }

    @Override
    public int hashCode() {
        return Objects.hash(source, target, value);
    }
}
